﻿using UnityEngine;
using System.Collections;

public class GameManage : MonoBehaviour
{
    public static int GAME_MENU = 0;
    public static int GAME_PLAY = 1;
    public static int GAME_END = 2;

    public Transform firstBg;

    public static GameManage _intance;

    public int score = 0;

    public int gameState = GAME_MENU;

    private GameObject bird;

	// Use this for initialization
	void Awake ()
	{
	    _intance = this;
	    bird = GameObject.FindGameObjectWithTag("Player");

	}
	
	// Update is called once per frame
	void Update () {
        if (gameState == GAME_MENU)
	    {
	        if (Input.GetMouseButtonDown(0))
	        {
	            gameState = GAME_PLAY;
	            bird.SendMessage("GetActive");
	        }
	    }
	    if (gameState == GAME_END)
	    {
	        EndControl._instance.gameObject.SetActive(true);
	        EndControl._instance.UpdateScore(score);
	    }
	}
}
